package com.cmbc.bean;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author jianghaoqiang
 * @Date 2022/5/22
 * 3.通过注解@Component来定义bean
 */
public class CreateByAnotationComponentTest {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext annotationConfigApplicationContext =new AnnotationConfigApplicationContext(Config2.class);
        User user=annotationConfigApplicationContext.getBean("user",User.class);
        System.out.println(user);
    }
}
